# Contributor: psykose <alice@ayaya.dev>
# Maintainer: psykose <alice@ayaya.dev>
pkgname=sbctl
pkgver=0.9
pkgrel=1
pkgdesc="Secure Boot key manager"
url="https://github.com/Foxboron/sbctl/"
arch="all"
license="MIT"
depends="binutils lsblk"
makedepends="asciidoc go"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/Foxboron/sbctl/releases/download/$pkgver/sbctl-$pkgver.tar.gz"

export GOFLAGS="$GOFLAGS -modcacherw -trimpath"

build() {
	make
	./sbctl completion bash > sbctl.bash
	./sbctl completion fish > sbctl.fish
	./sbctl completion zsh > sbctl.zsh
}

check() {
	make test
}

package() {
	install -D -m755 sbctl -t "$pkgdir"/usr/bin
	install -D -m644 sbctl.bash \
		"$pkgdir"/usr/share/bash-completion/completions/sbctl
	install -D -m644 sbctl.fish \
		"$pkgdir"/usr/share/fish/completions/sbctl.fish
	install -D -m644 sbctl.zsh \
		"$pkgdir"/usr/share/zsh/site-functions/_sbctl
	install -D -m644 docs/sbctl.8 \
		-t "$pkgdir"/usr/share/man/man8
}

sha512sums="
5b1d02dce29ca2adc96048191ebdd07003d4ada28fb829fb829db27645710696502efe1c4b94166df7ddeceaa283cc713e7d9195c11291d426a69aa3cce5cf22  sbctl-0.9.tar.gz
"
